package com.xymtop.api.config;

import com.xymtop.api.XymtopApplication;

import com.xymtop.api.inspector.Ins;
import com.xymtop.api.inspector.ProjectIns;
import jakarta.annotation.Resource;
import org.aspectj.org.eclipse.jdt.internal.compiler.env.IModule;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * @ClassName : InsConfig
 * @Description : 审查器配置
 * @Author : 肖叶茂
 * @Date: 2022/12/4  11:56
 */
@Configuration
public class InsConfig implements WebMvcConfigurer {


    @Autowired
    private ProjectIns projectIns;

    @Override
    public void addCorsMappings(CorsRegistry registry) {
//        commentIns.startTask();
//        projectIns.startTask();
//        List<String> cs = ServiceLocator.getAllIPeopleImpl();
//        ClassLoader urlClassLoader = XymtopApplication.class.getClassLoader();
//        for (int i = 0; i < cs.size(); i++) {
//            try {
////                Class c = Class.forName(CommentIns.class.toString());
//                Class c = urlClassLoader.loadClass(CommentIns.class.toString());
//                Object ob = c.newInstance();
//                Method m =  c.getDeclaredMethod("startTask");
//                m.invoke(ob);
//            } catch (ClassNotFoundException e) {
//                e.printStackTrace();
//            } catch (NoSuchMethodException e) {
//                e.printStackTrace();
//            } catch (InvocationTargetException e) {
//                e.printStackTrace();
//            } catch (IllegalAccessException e) {
//                e.printStackTrace();
//            } catch (InstantiationException e) {
//                e.printStackTrace();
//            }

//        }

    }



}



